import sys

sys.path.append('..')

from eventmanager import EventManager,Topic

def testSubscriber1(a,b,c):
    for i in range(10000000):
        pass
    print 'testSubscriber1 %d %d %d' % (a,b,c)

def testSubscriber2(a,b,c):
    for i in range(15000):
        pass
    print 'testSubscriber2: %d %d %d' % (a,b,c)


class TestSubscriber:
    def __init__(self):
        pass
    
    def testing(self,a,b,c):
        print "class TestSubscriber %d %d %d" % (a,b,c)
        
    



if __name__ == '__main__':
    
    e = EventManager()
    topic = e.addTopic('testSubscriber')
    topic.subscribe(testSubscriber1)
    topic.subscribe(testSubscriber2)
    t = TestSubscriber()
    topic.subscribe(t.testing)

    a,b,c = 1,2,3
    topic.publish(a,b,c)
    print 'published'
    
